* FILE LAST RUN ON 02/06/2024 USING STATA/SE 17.0

clear all
set maxvar 25000
set matsize 11000

cd ""
* Please change the directory according to your set-up
use .\BES\BES_final.dta, clear

/* TO RUN THIS FILE
1) Make sure the BES_final.dta is in a BES subfolder 
2) Make sure that the do file creating the main tables are in the folder Table
3) Please install programme estout in case at ssc install estout, replace
4) Please create a subfolder Results
*/

****************** OLS REGRESSIONS


******** Life meaning and happiness

local sample
local mean
local fe_wave

reg lifeHappyW WhiteMale if lifeHappyW<11, robust
* Regression without controls. The if command ensures that missing values are not included (lifeHappyW=9999)
qui sum lifeHappyW if e(sample)
estadd local mean =`r(mean)'
estadd local sample "All"
est store happy1
reg lifeHappyW WhiteMale HigherEdu HighSchool Own Married Divorced ageW income1-income15 workstatus1-workstatus7 sector1-sector3 i.W if lifeHappyW<11, robust
* Regression with controls. The if command ensures that missing values are not included (lifeHappyW=9999)
qui sum lifeHappyW if e(sample)
estadd local mean =`r(mean)'
estadd local fe_wave "$\checkmark$"
estadd local sample "All"
est store happy2
reg lifeHappyW WhiteMale HigherEdu HighSchool Own Married Divorced ageW income1-income15 workstatus1-workstatus7 sector1-sector3 i.W if lifeHappyW<11 & White ==1, robust
* Regression with controls. The if command ensures that missing values are not included (lifeHappyW=9999) and the sample is restricted to whites
qui sum lifeHappyW if e(sample)
estadd local mean =`r(mean)'
estadd local fe_wave "$\checkmark$"
estadd local sample "White"
est store happy3

* Same structure as above.
reg lifeWorthwhileW WhiteMale  if lifeWorthwhileW<11, robust
qui sum lifeWorthwhileW if e(sample)
estadd local mean= `r(mean)'
estadd local sample "All"
est store happy4
reg lifeWorthwhileW WhiteMale HigherEdu HighSchool Own Married Divorced ageW income1-income15 workstatus1-workstatus7 sector1-sector3 i.W if lifeWorthwhileW<11 , robust
qui sum lifeWorthwhileW if e(sample)
estadd local mean =`r(mean)'
estadd local sample "All"
estadd local fe_wave "$\checkmark$"
est store happy5
reg lifeWorthwhileW WhiteMale HigherEdu HighSchool Own Married Divorced ageW income1-income15 workstatus1-workstatus7 sector1-sector3 i.W if lifeWorthwhileW<11 & White == 1, robust
qui sum lifeWorthwhileW if e(sample)
estadd local mean = `r(mean)'
estadd local sample "White"
estadd local fe_wave "$\checkmark$"
est store happy6


qui do .\Table\Table_Happy 
* The following command exports the table for Online Appendix D (same for every regression below)

* The following command exports the full table for Online Appendix F (available in the file Angry White Males - Dataverse.pdf in the APSR dataverse for this article)
esttab   happy2 happy3  happy5 happy6 using "./Results/fulltable_happy", tex replace se obslast collabels(, none) nomtitle /// 
	/// We export the estimates from column1 to column4 in the file ab_comparison (in a specific folder)
	/// in the form of a tex file (you can choose other format) displaying standard errors instead of t-stat, with observations last
	 star(* 0.10 ** 0.05 *** 0.01) wrap mlabel("Happy yesterday" "Happy yesterday" "Life worthwhile" "Life worthwhile") ///
	/// Add the stars and label the columns
	 nonumbers cells(b(star fmt(4)) se(fmt(4) par)) compress label keep(WhiteMale Own Married Divorced HigherEdu HighSchool ageW income*  workstatus* sector*)  gaps  ///
	 /// The most important commands here are that we ask for 3 decimals (fmt(3)) for coeff and st. errors, we also use label
	 stats(sample fe_wave N, fmt(a1 %9.0fc 0)  labels(`"Sample"' `"Wave FE"' `"N.obs"'))  legend
	 /// Here we have the stats shown after the coefficients as well as their associated label



************ Gone too far regression all observations

* For each policy (black, gender, gay), regressions are run with and without control

local fe_wave


reg blackTooMuch WhiteMale, robust
qui sum blackTooMuch if e(sample)
estadd local mean= `r(mean)'
est store discrimmodel1

reg blackTooMuch WhiteMale Own Married Divorced HigherEdu HighSchool ageW income1-income15 workstatus1-workstatus7 sector1-sector3 i.W, robust
qui sum blackTooMuch if e(sample)
estadd local mean= `r(mean)'
estadd local fe_wave "$\checkmark$"
est store discrimmodel2


reg genderTooMuch WhiteMale, robust 
qui sum genderTooMuch if e(sample)
estadd local mean= `r(mean)'
est store discrimmodel3
reg genderTooMuch WhiteMale Own Married Divorced HigherEdu HighSchool ageW income1-income15 workstatus1-workstatus7 sector1-sector3 i.W, robust
qui sum genderTooMuch if e(sample)
estadd local mean= `r(mean)'
estadd local fe_wave "$\checkmark$"
est store discrimmodel4


reg gayTooMuch WhiteMale, robust 
qui sum gayTooMuch if e(sample)
estadd local mean= `r(mean)'
est store discrimmodel5
reg gayTooMuch WhiteMale Own Married Divorced HigherEdu HighSchool ageW income1-income15 workstatus1-workstatus7 sector1-sector3 i.W, robust
qui sum gayTooMuch if e(sample)
estadd local mean= `r(mean)'
estadd local fe_wave "$\checkmark$"
est store discrimmodel6

qui do .\Table\Table_White 
* The following command exports the table for Online Appendix D (same for every regression below)

* The following command exports the full table for Online Appendix F (available in the file Angry White Males - Dataverse.pdf in the APSR dataverse for this article)
esttab  discrimmodel2 discrimmodel4 discrimmodel6 using "./Results/fulltable_whitemale", tex replace se obslast collabels(, none) nomtitle /// 
	/// We export the estimates from column1 to column4 in the file ab_comparison (in a specific folder)
	/// in the form of a tex file (you can choose other format) displaying standard errors instead of t-stat, with observations last
	 star(* 0.10 ** 0.05 *** 0.01) wrap mlabel("Minorities too far" "Women too far" "L-G too far") ///
	/// Add the stars and label the columns
	 nonumbers cells(b(star fmt(4)) se(fmt(4) par)) compress label keep(WhiteMale Own Married Divorced HigherEdu HighSchool ageW income*  workstatus* sector*)  gaps  ///
	 /// The most important commands here are that we ask for 3 decimals (fmt(3)) for coeff and st. errors, we also use label
	 stats(fe_wave N, fmt(a1 %9.0fc 0)  labels(`"Wave FE"' `"N.obs"'))  legend
	 /// Here we have the stats shown after the coefficients as well as their associated label


* GONE TOO FAR BY EDUCATION

* For each policy (black, gender, gay), three regressions with controls are run: 
* The first for individuals who have not finished High School or not revealed their degrees
* The second for individuals who have finished High School and completed none of some university education
* The third for individuals who have at least a Bachelor degree


local educ 

reg blackTooMuch WhiteMale Own Married Divorced ageW income1-income15 workstatus1-workstatus7 sector1-sector3 i.W if HigherEdu == 0 & HighSchool == 0 , robust
qui sum blackTooMuch if e(sample)
estadd local mean= `r(mean)'
estadd local fe_wave "$\checkmark$"
estadd local educ "No qualif./answer"

est store educ1


reg blackTooMuch WhiteMale Own Married Divorced ageW income1-income15 workstatus1-workstatus7 sector1-sector3 i.W if HigherEdu == 0 & HighSchool == 1 , robust
qui sum blackTooMuch if e(sample)
estadd local mean= `r(mean)'
estadd local fe_wave "$\checkmark$"
estadd local educ "HighSchool"

est store educ2

reg blackTooMuch WhiteMale Own Married Divorced ageW income1-income15 workstatus1-workstatus7 sector1-sector3 i.W if HigherEdu == 1 & HighSchool == 0 , robust
qui sum blackTooMuch if e(sample)
estadd local mean= `r(mean)'
estadd local fe_wave "$\checkmark$"
estadd local educ "University"
est store educ3

reg genderTooMuch WhiteMale Own Married Divorced ageW income1-income15 workstatus1-workstatus7 sector1-sector3 i.W if HigherEdu == 0 & HighSchool == 0 , robust
qui sum genderTooMuch if e(sample)
estadd local mean= `r(mean)'
estadd local fe_wave "$\checkmark$"
estadd local educ "No qualif./answer"
est store educ4

reg genderTooMuch WhiteMale Own Married Divorced ageW income1-income15 workstatus1-workstatus7 sector1-sector3 i.W if HigherEdu == 0 & HighSchool == 1 , robust
qui sum genderTooMuch if e(sample)
estadd local mean= `r(mean)'
estadd local fe_wave "$\checkmark$"
estadd local educ "High School"
est store educ5

reg genderTooMuch WhiteMale Own Married Divorced ageW income1-income15 workstatus1-workstatus7 sector1-sector3 i.W if HigherEdu == 1 & HighSchool == 0 , robust
qui sum genderTooMuch if e(sample)
estadd local mean= `r(mean)'
estadd local fe_wave "$\checkmark$"
estadd local educ "University"
est store educ6



reg gayTooMuch WhiteMale Own Married Divorced ageW income1-income15 workstatus1-workstatus7 sector1-sector3 i.W if HigherEdu == 0 & HighSchool == 0 , robust
qui sum gayTooMuch if e(sample)
estadd local mean= `r(mean)'
estadd local fe_wave "$\checkmark$"
estadd local educ "No qualif./answer"

est store educ7


reg gayTooMuch WhiteMale Own Married Divorced ageW income1-income15 workstatus1-workstatus7 sector1-sector3 i.W if HigherEdu == 0 & HighSchool == 1 , robust
qui sum gayTooMuch if e(sample)
estadd local mean= `r(mean)'
estadd local fe_wave "$\checkmark$"
estadd local educ "HighSchool"

est store educ8

reg gayTooMuch WhiteMale Own Married Divorced ageW income1-income15 workstatus1-workstatus7 sector1-sector3 i.W if HigherEdu == 1 & HighSchool == 0 , robust
qui sum gayTooMuch if e(sample)
estadd local mean= `r(mean)'
estadd local fe_wave "$\checkmark$"
estadd local educ "University"
est store educ9

qui do .\Table\Table_White_educ
* The following command exports the table for Online Appendix D (same for every regression below)

* The following command exports the full table for Online Appendix F (available in the file Angry White Males - Dataverse.pdf in the APSR dataverse for this article)
esttab  educ* using "./Results/fulltable_educ", tex replace se obslast collabels(, none) nomtitle /// 
	/// We export the estimates from column1 to column4 in the file ab_comparison (in a specific folder)
	/// in the form of a tex file (you can choose other format) displaying standard errors instead of t-stat, with observations last
	 star(* 0.10 ** 0.05 *** 0.01) wrap mlabel("Minorities" "Minorities" "Minorities" "Women" "Women" "Women" "L-G" "L-G" "L-G") ///
	/// Add the stars and label the columns
	 nonumbers cells(b(star fmt(4)) se(fmt(4) par)) compress label keep(WhiteMale Own Married Divorced ageW income*  workstatus* sector*)  gaps  ///
	 /// The most important commands here are that we ask for 3 decimals (fmt(3)) for coeff and st. errors, we also use label
	 stats(educ fe_wave N, fmt(a1 %9.0fc 0)  labels(`"Sample"' `"Wave FE"' `"N.obs"'))  legend
	 /// Here we have the stats shown after the coefficients as well as their associated label


	 
* GONE TOO FAR BY AGE GROUP

* For each policy (black, gender, gay), three regressions with controls are run: 
* The first for individuals below the age of 25
* The second for individuals between 26 and 64 years old
* The third for individuals over 65 years old


gen age25 = 0 if ageW !=.
replace age25 = 1 if ageW <=25
gen age26_64 = 0 if ageW !=.
replace age26_64 = 1 if ageW> 25 & ageW<65
gen age65 = 0 if ageW !=.
replace age65 = 1 if ageW >=65 & ageW!=.
* Gone too far by education
local age 


reg blackTooMuch WhiteMale Own Married Divorced ageW income1-income15 workstatus1-workstatus7 sector1-sector3 i.W if age25==1 , robust
estadd local fe_wave "$\checkmark$"
estadd local age "Under 25"
qui sum blackTooMuch if e(sample)
estadd local mean= `r(mean)'
est store age1

reg blackTooMuch WhiteMale Own Married Divorced ageW income1-income15 workstatus1-workstatus7 sector1-sector3 i.W if age26_64==1 , robust
estadd local fe_wave "$\checkmark$"
estadd local age "26-64"
qui sum blackTooMuch if e(sample)
estadd local mean= `r(mean)'
est store age2

reg blackTooMuch WhiteMale Own Married Divorced ageW income1-income15 workstatus1-workstatus7 sector1-sector3 i.W if age65==1 , robust
estadd local fe_wave "$\checkmark$"
estadd local age "Over 65"
qui sum blackTooMuch if e(sample)
estadd local mean= `r(mean)'
est store age3

reg genderTooMuch WhiteMale Own Married Divorced ageW income1-income15 workstatus1-workstatus7 sector1-sector3 i.W if age25==1 , robust
estadd local fe_wave "$\checkmark$"
estadd local age "Under 25"
qui sum genderTooMuch if e(sample)
estadd local mean= `r(mean)'
est store age4

reg genderTooMuch WhiteMale Own Married Divorced ageW income1-income15 workstatus1-workstatus7 sector1-sector3 i.W if age26_64==1 , robust
estadd local fe_wave "$\checkmark$"
estadd local age "26-64"
qui sum genderTooMuch if e(sample)
estadd local mean= `r(mean)'
est store age5

reg genderTooMuch WhiteMale Own Married Divorced ageW income1-income15 workstatus1-workstatus7 sector1-sector3 i.W if age65==1 , robust
estadd local fe_wave "$\checkmark$"
estadd local age "Over 65"
qui sum genderTooMuch if e(sample)
estadd local mean= `r(mean)'
est store age6

reg gayTooMuch WhiteMale Own Married Divorced ageW income1-income15 workstatus1-workstatus7 sector1-sector3 i.W if age25==1 , robust
estadd local fe_wave "$\checkmark$"
estadd local age "Under 25"
qui sum gayTooMuch if e(sample)
estadd local mean= `r(mean)'
est store age7

reg gayTooMuch WhiteMale Own Married Divorced ageW income1-income15 workstatus1-workstatus7 sector1-sector3 i.W if age26_64==1 , robust
estadd local fe_wave "$\checkmark$"
estadd local age "26-64"
qui sum gayTooMuch if e(sample)
estadd local mean= `r(mean)'
est store age8

reg gayTooMuch WhiteMale Own Married Divorced ageW income1-income15 workstatus1-workstatus7 sector1-sector3 i.W if age65==1 , robust
estadd local fe_wave "$\checkmark$"
estadd local age "Over 65"
qui sum gayTooMuch if e(sample)
estadd local mean= `r(mean)'
est store age9

qui do .\Table\Table_White_age
* The following command exports the table for Online Appendix D (same for every regression below)

* The following command exports the full table for Online Appendix F (available in the file Angry White Males - Dataverse.pdf in the APSR dataverse for this article)
esttab  age* using "./Results/fulltable_age", tex replace se obslast collabels(, none) nomtitle /// 
	/// We export the estimates from column1 to column4 in the file ab_comparison (in a specific folder)
	/// in the form of a tex file (you can choose other format) displaying standard errors instead of t-stat, with observations last
	 star(* 0.10 ** 0.05 *** 0.01) wrap mlabel("Minorities" "Minorities" "Minorities" "Women" "Women" "Women" "L-G" "L-G" "L-G") ///
	/// Add the stars and label the columns
	 nonumbers cells(b(star fmt(4)) se(fmt(4) par)) compress label keep(WhiteMale Own Married Divorced ageW income*  workstatus* sector*)  gaps  ///
	 /// The most important commands here are that we ask for 3 decimals (fmt(3)) for coeff and st. errors, we also use label
	 stats(age fe_wave N, fmt(a1 %9.0fc 0)  labels(`"Sample"' `"Wave FE"' `"N.obs"'))  legend
	 /// Here we have the stats shown after the coefficients as well as their associated label




* Discrimination regression all observations

local fe_wave

reg discrimMenW WhiteMale if discrimMenW<11, robust
qui sum discrimMenW if e(sample)
estadd local mean= `r(mean)'
est store discrimmodelQ1

reg discrimMenW WhiteMale Own Married Divorced HigherEdu HighSchool ageW income1-income15 workstatus1-workstatus7 sector1-sector3 i.W if discrimMenW<11, robust
estadd local fe_wave "$\checkmark$"
qui sum discrimMenW if e(sample)
estadd local mean= `r(mean)'
est store discrimmodelQ2

reg discrimWomenW WhiteMale if discrimWomenW<11, robust
estadd local fe_wave "$\checkmark$"
qui sum discrimWomenW if e(sample)
estadd local mean= `r(mean)'
est store discrimmodelQ3

reg discrimWomenW WhiteMale Own Married Divorced HigherEdu HighSchool ageW income1-income15 workstatus1-workstatus7 sector1-sector3 i.W if discrimWomenW<11, robust
estadd local fe_wave "$\checkmark$"
qui sum discrimWomenW if e(sample)
estadd local mean= `r(mean)'
est store discrimmodelQ4

reg discrimWhiteW WhiteMale if discrimWhiteW<11, robust
qui sum discrimWhiteW if e(sample)
estadd local mean= `r(mean)'
est store discrimmodelQ5

reg discrimWhiteW WhiteMale Own Married Divorced HigherEdu HighSchool ageW income1-income15 workstatus1-workstatus7 sector1-sector3 i.W if discrimWhiteW<11, robust
estadd local fe_wave "$\checkmark$"
qui sum discrimWhiteW if e(sample)
estadd local mean= `r(mean)'
est store discrimmodelQ6

reg discrimBMEW WhiteMale if discrimBMEW<11, robust
qui sum discrimBMEW if e(sample)
estadd local mean= `r(mean)'
est store discrimmodelQ7


reg discrimBMEW WhiteMale Own Married Divorced HigherEdu HighSchool ageW income1-income15 workstatus1-workstatus7 sector1-sector3 i.W if discrimBMEW<11, robust
estadd local fe_wave "$\checkmark$"
qui sum discrimBMEW if e(sample)
estadd local mean= `r(mean)'
est store discrimmodelQ8

qui do .\Table\Table_Discrim 
* The following command exports the table for Online Appendix D (same for every regression below)

* The following command exports the full table for Online Appendix F (available in the file Angry White Males - Dataverse.pdf in the APSR dataverse for this article)
esttab  discrimmodelQ2 discrimmodelQ4 discrimmodelQ6 discrimmodelQ8  using "./Results/fulltable_discrim", tex replace se obslast collabels(, none) nomtitle /// 
	/// We export the estimates from column1 to column4 in the file ab_comparison (in a specific folder)
	/// in the form of a tex file (you can choose other format) displaying standard errors instead of t-stat, with observations last
	 star(* 0.10 ** 0.05 *** 0.01) wrap mlabel("Men discriminated" "Women discriminated" "White discriminated" "BME discriminated" ) ///
	/// Add the stars and label the columns
	 nonumbers cells(b(star fmt(4)) se(fmt(4) par)) compress label keep(WhiteMale Own Married Divorced HigherEdu HighSchool ageW income*  workstatus* sector*)  gaps  ///
	 /// The most important commands here are that we ask for 3 decimals (fmt(3)) for coeff and st. errors, we also use label
	 stats(fe_wave N, fmt(a1 %9.0fc 0)  labels(`"Wave FE"' `"N.obs"'))  legend
	 /// Here we have the stats shown after the coefficients as well as their associated label
	 


* Discrimination regression by education

* For discrimination against men and discrimination against whites, three regressions with controls are run: 
* The first for individuals who have not finished High School or not revealed their degrees
* The second for individuals who have finished High School and completed none of some university education
* The third for individuals who have at least a Bachelor degree


local fe_wave
local educ

reg discrimMenW WhiteMale Own Married Divorced ageW income1-income15 workstatus1-workstatus7 sector1-sector3 i.W if discrimMenW<11 & HighSchool == 0 & HigherEdu == 0, robust
qui sum discrimMenW if e(sample)
estadd local mean= `r(mean)'
estadd local fe_wave "$\checkmark$"
estadd local educ "No qualif./answer"
est store discrim_educ1

reg discrimMenW WhiteMale Own Married Divorced ageW income1-income15 workstatus1-workstatus7 sector1-sector3 i.W if discrimMenW<11 & HighSchool == 1 & HigherEdu == 0, robust
qui sum discrimMenW if e(sample)
estadd local mean= `r(mean)'
estadd local fe_wave "$\checkmark$"
estadd local educ "High School"
est store discrim_educ2

reg discrimMenW WhiteMale Own Married Divorced ageW income1-income15 workstatus1-workstatus7 sector1-sector3 i.W if discrimMenW<11 & HighSchool == 0 & HigherEdu == 1, robust
qui sum discrimMenW if e(sample)
estadd local mean= `r(mean)'
estadd local fe_wave "$\checkmark$"
estadd local educ "University"
est store discrim_educ3

reg discrimWhiteW WhiteMale Own Married Divorced ageW income1-income15 workstatus1-workstatus7 sector1-sector3 i.W if discrimWhiteW<11 & HighSchool == 0 & HigherEdu == 0, robust
qui sum discrimWhiteW if e(sample)
estadd local mean= `r(mean)'
estadd local fe_wave "$\checkmark$"
estadd local educ "No qualif./answer"
est store discrim_educ4

reg discrimWhiteW WhiteMale Own Married Divorced ageW income1-income15 workstatus1-workstatus7 sector1-sector3 i.W if discrimWhiteW<11 & HighSchool == 1 & HigherEdu == 0, robust
qui sum discrimWhiteW if e(sample)
estadd local mean= `r(mean)'
estadd local fe_wave "$\checkmark$"
estadd local educ "High School"
est store discrim_educ5

reg discrimWhiteW WhiteMale Own Married Divorced ageW income1-income15 workstatus1-workstatus7 sector1-sector3 i.W if discrimWhiteW<11 & HighSchool == 0 & HigherEdu == 1, robust
qui sum discrimWhiteW if e(sample)
estadd local mean= `r(mean)'
estadd local fe_wave "$\checkmark$"
estadd local educ "University"
est store discrim_educ6

qui do .\Table\Table_Discrim_educ 
* The following command exports the table for Online Appendix D (same for every regression below)

* The following command exports the full table for Online Appendix F (available in the file Angry White Males - Dataverse.pdf in the APSR dataverse for this article)
esttab  discrim_educ* using "./Results/fulltable_discrim_educ", tex replace se obslast collabels(, none) nomtitle /// 
	/// We export the estimates from column1 to column4 in the file ab_comparison (in a specific folder)
	/// in the form of a tex file (you can choose other format) displaying standard errors instead of t-stat, with observations last
	 star(* 0.10 ** 0.05 *** 0.01) wrap mlabel("Men discriminated" "Men discriminated" "Men discriminated" "White discriminated" "White discriminated"  "White discriminated"  ) ///
	/// Add the stars and label the columns
	 nonumbers cells(b(star fmt(4)) se(fmt(4) par)) compress label keep(WhiteMale Own Married Divorced ageW income*  workstatus* sector*)  gaps  ///
	 /// The most important commands here are that we ask for 3 decimals (fmt(3)) for coeff and st. errors, we also use label
	 stats(educ fe_wave N, fmt(a1 %9.0fc 0)  labels(`"Sample"' `"Wave FE"' `"N.obs"'))  legend
	 /// Here we have the stats shown after the coefficients as well as their associated label
	 
	 


* Discrimination regression by age

* For discrimination against men and discrimination against whites, three regressions with controls are run:
* The first for individuals below the age of 25
* The second for individuals between 26 and 64 years old
* The third for individuals over 65 years old


local fe_wave
local age

reg discrimMenW WhiteMale Own Married Divorced ageW HigherEdu HighSchool income1-income15 workstatus1-workstatus7 sector1-sector3 i.W if discrimMenW<11 & age25==1, robust
qui sum discrimMenW if e(sample)
estadd local mean= `r(mean)'
estadd local fe_wave "$\checkmark$"
estadd local age "Under 25"
est store discrim_age1

reg discrimMenW WhiteMale Own Married Divorced ageW HigherEdu HighSchool income1-income15 workstatus1-workstatus7 sector1-sector3 i.W if discrimMenW<11 & age26_64==1, robust
qui sum discrimMenW if e(sample)
estadd local mean= `r(mean)'
estadd local fe_wave "$\checkmark$"
estadd local age "26-64"
est store discrim_age2

reg discrimMenW WhiteMale Own Married Divorced ageW HigherEdu HighSchool income1-income15 workstatus1-workstatus7 sector1-sector3 i.W if discrimMenW<11 & age65==1, robust
qui sum discrimMenW if e(sample)
estadd local mean= `r(mean)'
estadd local fe_wave "$\checkmark$"
estadd local age "Over 65"
est store discrim_age3

reg discrimWhiteW WhiteMale Own Married Divorced ageW HigherEdu HighSchool income1-income15 workstatus1-workstatus7 sector1-sector3 i.W if discrimWhiteW<11 & age25==1, robust
qui sum discrimWhiteW if e(sample)
estadd local mean= `r(mean)'
estadd local fe_wave "$\checkmark$"
estadd local age "Under 25"
est store discrim_age4

reg discrimWhiteW WhiteMale Own Married Divorced ageW HigherEdu HighSchool income1-income15 workstatus1-workstatus7 sector1-sector3 i.W if discrimWhiteW<11 & age26_64==1, robust
qui sum discrimWhiteW if e(sample)
estadd local mean= `r(mean)'
estadd local fe_wave "$\checkmark$"
estadd local age "26-64"
est store discrim_age5

reg discrimWhiteW WhiteMale Own Married Divorced ageW HigherEdu HighSchool income1-income15 workstatus1-workstatus7 sector1-sector3 i.W if discrimWhiteW<11 & age65==1, robust
qui sum discrimWhiteW if e(sample)
estadd local mean= `r(mean)'
estadd local fe_wave "$\checkmark$"
estadd local age "Over 65"
est store discrim_age6

qui do .\Table\Table_Discrim_age 
* The following command exports the table for Online Appendix D (same for every regression below)

* The following command exports the full table for Online Appendix F (available in the file Angry White Males - Dataverse.pdf in the APSR dataverse for this article)
esttab  discrim_age* using "./Results/fulltable_discrim_age", tex replace se obslast collabels(, none) nomtitle /// 
	/// We export the estimates from column1 to column4 in the file ab_comparison (in a specific folder)
	/// in the form of a tex file (you can choose other format) displaying standard errors instead of t-stat, with observations last
	 star(* 0.10 ** 0.05 *** 0.01) wrap mlabel("Men discriminated" "Men discriminated" "Men discriminated" "White discriminated" "White discriminated"  "White discriminated"  ) ///
	/// Add the stars and label the columns
	 nonumbers cells(b(star fmt(4)) se(fmt(4) par)) compress label keep(WhiteMale Own Married Divorced ageW income*  workstatus* sector*)  gaps  ///
	 /// The most important commands here are that we ask for 3 decimals (fmt(3)) for coeff and st. errors, we also use label
	 stats(age fe_wave N, fmt(a1 %9.0fc 0)  labels(`"Sample"' `"Wave FE"' `"N.obs"'))  legend
	 /// Here we have the stats shown after the coefficients as well as their associated label
	 	 
	 
***************************** PROBIT MODELS *************************************
* Here I rerun the main models (without splitting samples by educations or ages), using Probit instead of OLS.

* Life satisfaction and happiness

local sample
local mean

oprobit lifeHappyW WhiteMale if lifeHappyW<11, robust
estadd local sample "All"
est store happy1

oprobit lifeHappyW WhiteMale HigherEdu HighSchool Own Married Divorced ageW income1-income15 workstatus1-workstatus7 sector1-sector3  if lifeHappyW<11, robust
estadd local sample "All"
est store happy2

oprobit lifeHappyW WhiteMale HigherEdu HighSchool Own Married Divorced ageW income1-income15 workstatus1-workstatus7 sector1-sector3  if lifeHappyW<11 & White ==1, robust
estadd local sample "White"
est store happy3


oprobit lifeWorthwhileW WhiteMale  if lifeWorthwhileW<11, robust
estadd local sample "All"
est store happy4

oprobit lifeWorthwhileW WhiteMale HigherEdu HighSchool Own Married Divorced ageW income1-income15 workstatus1-workstatus7 sector1-sector3 if lifeWorthwhileW<11 , robust
estadd local sample "All"
est store happy5

oprobit lifeWorthwhileW WhiteMale HigherEdu HighSchool Own Married Divorced ageW income1-income15 workstatus1-workstatus7 sector1-sector3 if lifeWorthwhileW<11 & White == 1, robust
estadd local sample "White"
est store happy6



* The following command exports the full table for Online Appendix F (available in the file Angry White Males - Dataverse.pdf in the APSR dataverse for this article)
esttab   happy* using "./Results/fulltable_happy_oprobit", tex replace se obslast collabels(, none) nomtitle /// 
	/// We export the estimates from column1 to column4 in the file ab_comparison (in a specific folder)
	/// in the form of a tex file (you can choose other format) displaying standard errors instead of t-stat, with observations last
	 star(* 0.10 ** 0.05 *** 0.01) wrap mlabel("Happy yesterday" "Happy yesterday" "Life satisfying"  "Life satisfying" ) ///
	/// Add the stars and label the columns
	 nonumbers cells(b(star fmt(4)) se(fmt(4) par)) compress label keep(WhiteMale Own Married Divorced HigherEdu HighSchool ageW income*  workstatus* sector*)  gaps  ///
	 /// The most important commands here are that we ask for 3 decimals (fmt(3)) for coeff and st. errors, we also use label
	 stats(sample N, fmt(a1 %9.0fc 0)  labels(`"Sample"' `"N.obs"'))  legend
	 /// Here we have the stats shown after the coefficients as well as their associated label



* Gone too far regression all observations

local fe_wave


probit blackTooMuch WhiteMale, robust
est store discrimmodel1

probit blackTooMuch WhiteMale Own Married Divorced HigherEdu HighSchool ageW income1-income15 workstatus1-workstatus7 sector1-sector3 i.W, robust
estadd local fe_wave "$\checkmark$"
est store discrimmodel2


probit genderTooMuch WhiteMale, robust
est store discrimmodel3

probit genderTooMuch WhiteMale Own Married Divorced HigherEdu HighSchool ageW income1-income15 workstatus1-workstatus7 sector1-sector3 i.W, robust
estadd local fe_wave "$\checkmark$"
est store discrimmodel4


probit gayTooMuch WhiteMale, robust
est store discrimmodel5

probit gayTooMuch WhiteMale Own Married Divorced HigherEdu HighSchool ageW income1-income15 workstatus1-workstatus7 sector1-sector3 i.W, robust
estadd local fe_wave "$\checkmark$"
est store discrimmodel6



* The following command exports the full table for Online Appendix F (available in the file Angry White Males - Dataverse.pdf in the APSR dataverse for this article)
esttab  discrimmodel* using "./Results/fulltable_white_probit", tex replace se obslast collabels(, none) nomtitle /// 
	/// We export the estimates from column1 to column4 in the file ab_comparison (in a specific folder)
	/// in the form of a tex file (you can choose other format) displaying standard errors instead of t-stat, with observations last
	 star(* 0.10 ** 0.05 *** 0.01) wrap mlabel("Minorities too far" "Women too far" "L-G too far") ///
	/// Add the stars and label the columns
	 nonumbers cells(b(star fmt(4)) se(fmt(4) par)) compress label keep(WhiteMale Own Married Divorced HigherEdu HighSchool ageW income*  workstatus* sector*)  gaps  ///
	 /// The most important commands here are that we ask for 3 decimals (fmt(3)) for coeff and st. errors, we also use label
	 stats(fe_wave N, fmt(a1 %9.0fc 0)  labels(`"Wave FE"' `"N.obs"'))  legend
	 /// Here we have the stats shown after the coefficients as well as their associated label

	 

* Discrimination regression all observations

local fe_wave

oprobit discrimMenW WhiteMale if discrimMenW<11, robust
est store discrimmodelQ1

oprobit discrimMenW WhiteMale Own Married Divorced HigherEdu HighSchool ageW income1-income15 workstatus1-workstatus7 sector1-sector3 i.W if discrimMenW<11, robust
estadd local fe_wave "$\checkmark$"
est store discrimmodelQ2

oprobit discrimWomenW WhiteMale if discrimWomenW<11, robust
estadd local fe_wave "$\checkmark$"
est store discrimmodelQ3

oprobit discrimWomenW WhiteMale Own Married Divorced HigherEdu HighSchool ageW income1-income15 workstatus1-workstatus7 sector1-sector3 i.W if discrimWomenW<11, robust
estadd local fe_wave "$\checkmark$"
est store discrimmodelQ4

oprobit discrimWhiteW WhiteMale if discrimWhiteW<11, robust
est store discrimmodelQ5

oprobit discrimWhiteW WhiteMale Own Married Divorced HigherEdu HighSchool ageW income1-income15 workstatus1-workstatus7 sector1-sector3 i.W if discrimWhiteW<11, robust
estadd local fe_wave "$\checkmark$"
est store discrimmodelQ6

oprobit discrimBMEW WhiteMale if discrimBMEW<11, robust
est store discrimmodelQ7


oprobit discrimBMEW WhiteMale Own Married Divorced HigherEdu HighSchool ageW income1-income15 workstatus1-workstatus7 sector1-sector3 i.W if discrimBMEW<11, robust
estadd local fe_wave "$\checkmark$"
est store discrimmodelQ8


* The following command exports the full table for Online Appendix F (available in the file Angry White Males - Dataverse.pdf in the APSR dataverse for this article)
esttab  discrimmodelQ* using "./Results/fulltable_discrim_oprobit", tex replace se obslast collabels(, none) nomtitle /// 
	/// We export the estimates from column1 to column4 in the file ab_comparison (in a specific folder)
	/// in the form of a tex file (you can choose other format) displaying standard errors instead of t-stat, with observations last
	 star(* 0.10 ** 0.05 *** 0.01) wrap mlabel("Men discriminated" "Women discriminated" "White discriminated" "BME discriminated" ) ///
	/// Add the stars and label the columns
	 nonumbers cells(b(star fmt(4)) se(fmt(4) par)) compress label keep(WhiteMale Own Married Divorced HigherEdu HighSchool ageW income*  workstatus* sector*)  gaps  ///
	 /// The most important commands here are that we ask for 3 decimals (fmt(3)) for coeff and st. errors, we also use label
	 stats(fe_wave N, fmt(a1 %9.0fc 0)  labels(`"Wave FE"' `"N.obs"'))  legend
	 /// Here we have the stats shown after the coefficients as well as their associated label
	 
	 